﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DonDatHang.ascx.cs" Inherits="DonDatHang" %>

<center>
    <asp:Panel ID="pnGridDetail" runat="server" Width="700px">
        <span class="BigLabel1">DANH SÁCH ĐƠN ĐẶT HÀNG</span><br />
        Trạng thái xử lý:&nbsp;
        <asp:DropDownList runat="server" ID="cboTrangThai" AutoPostBack="True" 
            onselectedindexchanged="cboTrangThai_SelectedIndexChanged">
            <asp:ListItem Text="Mới" Value="0"></asp:ListItem>
            <asp:ListItem Text="Đã xử lý" Value="1"></asp:ListItem>
            <asp:ListItem Text="Tất cả" Value="-1"></asp:ListItem>
        </asp:DropDownList>
        
        <asp:DataGrid ID="grDonHang" runat="server" AllowPaging="false" AutoGenerateColumns="False"
            Width="100%" PageSize="5" onitemcommand="grDonHang_ItemCommand">
            <PagerStyle Mode="NumericPages" />
            <Columns>
                <asp:BoundColumn HeaderText="<span>Số hóa đơn</span>" DataField="id"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="<span>Khách hàng</span>" DataField="hoten"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="<span>Địa chỉ</span>" DataField="DiaChi"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="<span>Điện thoại</span>" DataField="DiDong"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="<span>Trạng thái</span>" DataField="tenTrangThai"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="<span>Tổng tiền</span>" DataField="TongTien"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="<span>Ngày đặt hàng</span>" DataField="NGaytao"></asp:BoundColumn>
                <asp:BoundColumn HeaderText="<span>Ngày giao hàng</span>" DataField="ThoiGianVanChuyen"></asp:BoundColumn>
                <asp:TemplateColumn>
                    <ItemTemplate>
                        <asp:Button CausesValidation="False" ID="cmdEdit" runat="server" Text="Xử lý" 
                            CommandName="cmdEdit"></asp:Button>
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
            <HeaderStyle CssClass="HeaderRow" Font-Bold="True" />
        </asp:DataGrid>
        <br />
    </asp:Panel>
    <asp:Panel ID="pnEditDetail" runat="server" Width="700px">
        <br />
        <div class="BigLabel1" id="chiTietHoaDon" style="margin-bottom: 15px;">HÓA ĐƠN MUA
            HÀNG</div>
        <table width="100%" class="TableStyle" cellpadding="5" cellspacing="1">
            <tr bgcolor="#f7f7f7">
                <td colspan="4" align="left" class="style1">
                    <b>Thông tin đơn hàng </b>
                </td>
            </tr>
            <tr bgcolor="#f7f7f7">
                <td colspan="2" align="left">
                    Số hóa đơn
                </td>
                <td colspan="2" align="left">
                    <asp:Label runat="server" ID="lblId"></asp:Label>
                </td>
            </tr>
            <tr bgcolor="#f7f7f7">
                <td colspan="2" align="left">
                    Ngày mua
                </td>
                <td colspan="2" align="left">
                    <asp:Label runat="server" ID="lblNgayTao"></asp:Label>
                </td>
            </tr>
            <tr bgcolor="#f7f7f7">
                <td colspan="4" align="left">
                    <b>Thông tin khách hàng </b>
                </td>
            </tr>
            <tr bgcolor="#f7f7f7">
                <td colspan="2" align="left">
                    <b>Người đặt hàng</b>
                </td>
                <td colspan="2" align="left">
                    <b>Vận chuyển đến</b>
                </td>
            </tr>
            <tr bgcolor="#f7f7f7">
                <td colspan="1" align="left">
                    Họ và tên
                </td>
                <td colspan="1" align="left">
                    <asp:Label runat="server" ID="lblHoTen"></asp:Label>
                </td>
                <td colspan="1" align="left">
                    Họ và tên
                </td>
                <td colspan="1" align="left">
                    <asp:Label runat="server" ID="lblHoTen1"></asp:Label>
                </td>
            </tr>
            <tr bgcolor="#f7f7f7">
                <td colspan="1" align="left">
                    Địa chỉ
                </td>
                <td colspan="1" align="left">
                    <asp:Label runat="server" ID="lblDiaChi"></asp:Label>
                </td>
                <td colspan="1" align="left">
                    Địa chỉ
                </td>
                <td colspan="1" align="left">
                    <asp:Label runat="server" ID="lblDiaChi1"></asp:Label>
                </td>
            </tr>
            <tr bgcolor="#f7f7f7">
                <td colspan="1" align="left">
                    Email
                </td>
                <td colspan="1" align="left">
                    <asp:Label runat="server" ID="lblEmail"></asp:Label>
                </td>
                <td colspan="1" align="left">
                    Email
                </td>
                <td colspan="1" align="left">
                    <asp:Label runat="server" ID="lblEmail1"></asp:Label>
                </td>
            </tr>
            <tr bgcolor="#f7f7f7">
                <td colspan="1" align="left">
                    Điện thoại
                </td>
                <td colspan="1" align="left">
                    <asp:Label runat="server" ID="lblDienThoai"></asp:Label>
                </td>
                <td colspan="1" align="left">
                    Điện thoại
                </td>
                <td colspan="1" align="left">
                    <asp:Label runat="server" ID="lblDienThoai1"></asp:Label>
                </td>
            </tr>
            <tr bgcolor="#f7f7f7">
                <td colspan="1" align="left">
                    Di động
                </td>
                <td colspan="1" align="left">
                    <asp:Label runat="server" ID="lblDiDong"></asp:Label>
                </td>
                <td colspan="1" align="left">
                    Di động
                </td>
                <td colspan="1" align="left">
                    <asp:Label runat="server" ID="lblDiDong1"></asp:Label>
                </td>
            </tr>
            <tr bgcolor="#f7f7f7">
                <td colspan="1" align="left">
                    Ghi chú
                </td>
                <td colspan="3" align="left">
                    <asp:Label runat="server" ID="lblGhiChu"></asp:Label>
                </td>
            </tr>
        </table>
        <div class="BigLabel1" id="Div1" style="margin-bottom: 15px;">CHI TIẾT ĐẶT HÀNG</div>
        <table style="width: 100%; border: none; margin: 0 0 0 0; border-collapse: collapse">
            <tbody>
                <tr>
                    <th style="width: 40px; border: 1px solid #cccccc; padding: 8px 0; background-color: #f7f7f7">
                        STT
                    </th>
                    <th style="border: 1px solid #cccccc; padding: 8px 0; background-color: #f7f7f7">
                        Tên sản phẩm
                    </th>
                    <th style="width: 80px; border: 1px solid #cccccc; padding: 8px 0; background-color: #f7f7f7">
                        Số lượng
                    </th>
                    <th style="width: 140px; border: 1px solid #cccccc; padding: 8px 0; background-color: #f7f7f7">
                        Giá
                    </th>
                    <th style="width: 140px; border: 1px solid #cccccc; padding: 8px 0; background-color: #f7f7f7">
                        Tổng
                    </th>
                </tr>
                <asp:Repeater runat="server" ID="rptChiTiet">
                    <ItemTemplate>
                        <tr>
                            <td style="width: 40px; border: 1px solid #cccccc; padding: 8px; text-align: center;
                                vertical-align: middle">
                                 <%#Container.ItemIndex + 1 %>
                            </td>
                            <td style="border: 1px solid #cccccc; padding: 8px 0 0 15px">
                                <a target="_blank" style="color: #2b49a0; font-weight: bold; text-decoration: none;
                                    vertical-align: middle" href="../Detail.aspx?id=<%#Eval("SanphamID") %>"
                                    rel="nofollow"><%#Eval("Tenhang") %></a>
                            </td>
                            <td style="border: 1px solid #cccccc; padding: 8px 0 0 0; text-align: center;
                                vertical-align: middle">
                                <%#Eval("SoLuong") %>
                            </td>
                            <td style="border: 1px solid #cccccc; padding: 8px 0 0 15px; color: #df430d;
                                font-weight: bold; vertical-align: middle">
                                <%#TTQT.TTQT_Code.TTQTCommon.formatTien_KhongThapPhan(Eval("GiaBanCoChietKhau").ToString()) %> VND
                            </td>
                            <td style="border: 1px solid #cccccc; padding: 8px 0 0 15px; color: #df430d;
                                font-weight: bold; vertical-align: middle">
                                <%#TTQT.TTQT_Code.TTQTCommon.formatTien_KhongThapPhan((TTQT.TTQT_Code.TTQTCommon.ToDecimal(Eval("SoLuong"), 0) * TTQT.TTQT_Code.TTQTCommon.ToDecimal(Eval("GiaBanCoChietKhau"), 0)).ToString())%> VND
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
                <tr>
                    <td style="border: 1px solid #cccccc; padding: 8px; text-align: left; vertical-align: middle;
                        border-right: none; font-weight: bold" colspan="4">
                        Tổng tiền
                    </td>
                    <td style="width: 140px; border: 1px solid #cccccc; padding: 8px 0 0 15px; color: #df430d;
                        font-weight: bold; vertical-align: middle; border-left: none">
                        <asp:Literal runat="server" ID="lblTongTien"></asp:Literal>VND
                    </td>
                </tr>
                <tr>
                    <td colspan="5" align="center">
                        <asp:Button runat="server" ID="cmdCloseDon" Text="Đóng đơn hàng" 
                            OnClientClick="return confirm('Đánh dấu đơn hàng này là đã xử lý?');" 
                            onclick="cmdCloseDon_Click"/>
                            <asp:Button runat="server" ID="cmdXoa" Text="Xóa đơn hàng" 
                            OnClientClick="return confirm('Bạn có chắc muốn xóa đơn hàng này?');"/>
                        <asp:Button runat="server" ID="cmdReturn" Text="Quay lại" 
                            onclick="cmdReturn_Click"/>
                    </td>
                </tr>
            </tbody>
        </table>
    </asp:Panel>
</center>
<script language="javascript" type="text/javascript">
    $(document).ready(function()
    {
      $("#_ctl2_grDonHang tr:odd").css("background-color", "#FCFBDB");
    });
</script>